import { request } from "@/utils/service"
import type * as obj from "./types/dept"
import { IdForm, TreeData } from "../common/common"

/** 登录并返回 Token */
export function getTableDataApi() {
  return request<obj.TableData[]>({
    url: "/mp/dept/list",
    method: "get"
  })
}

export function getTreeDataApi() {
  return request<TreeData[]>({
    url: "/mp/dept/select",
    method: "get"
  })
}

/** 获取用户详情 */
export function saveTableDataApi(data: obj.CreateOrUpdateTableRequestData) {
  return request<string>({
    url: "/mp/dept/save",
    method: "post",
    data
  })
}

export function deleteTableDataApi(data: IdForm) {
  return request<string>({
    url: "/mp/dept/delete",
    method: "post",
    data
  })
}
